package com.itheima.goods.service.impl;

import com.itheima.feign.OrderClient;
import com.itheima.feign.UserClient;
import com.itheima.goods.mapper.DishMapper;
import com.itheima.goods.mapper.SetmealMapper;
import com.itheima.goods.service.WorkspaceService;
import com.itheima.goods.vo.DishOverViewVO;
import com.itheima.goods.vo.SetmealOverViewVO;
import com.itheima.vo.OrderOverViewVO;
import com.itheima.vo.BusinessDataVO;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class WorkspaceServiceImpl implements WorkspaceService {

//    @Autowired
//    private OrderMapper orderMapper;
    @Autowired
    private OrderClient orderClient;


    @Autowired
    private DishMapper dishMapper;
    @Autowired
    private SetmealMapper setmealMapper;
//    @Autowired
//    private UserMapper userMapper;
    @Autowired
    private UserClient userClient;
    /**
     * 查询订单管理数据
     * @return
     */
    @Override
    public OrderOverViewVO overviewOrders() {
//        return orderMapper.overviewOrders();
        return orderClient.overviewOrders();
    }
    /**
     * 查询菜品总览
     * @return
     */
    @Override
    public DishOverViewVO overviewDishes() {
        return dishMapper.overviewDishes();
    }
    /**
     * 查询套餐总览
     * @return
     */
    @Override
    public SetmealOverViewVO overviewSetmeals() {
        return setmealMapper.overviewSetmeals();
    }
    /**
     * 查询今日运营数据
     * @return
     */
    @Override
    public BusinessDataVO businessData() {
//        BusinessDataVO businessDataVO=orderMapper.businessData();
        BusinessDataVO businessDataVO = orderClient.businessData();

//        Integer newUsers= userMapper.select();
        Integer newUsers = userClient.selectCount();
        businessDataVO.setNewUsers(newUsers);
        return businessDataVO;
    }
}
